package com.stupro.cjlu.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.stupro.cjlu.common.vo.StudentCourseItemVO;
import com.stupro.cjlu.common.vo.StudentCourseSelectedItemVO;
import com.stupro.cjlu.common.vo.StudentExamItemVO;
import com.stupro.cjlu.common.vo.TimetableItemVO;
import com.stupro.cjlu.entity.Studentcourse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Administrator
 * @since 2021-05-10
 */
@Repository
public interface StudentcourseMapper extends BaseMapper<Studentcourse> {
    Integer count(@Param("className")String className, @Param("courseName")String courseName, @Param("studentName")String studentName);

    @Select("select sc.*,c.coName,s.stuName,s.stuClass from course c,studentcourse sc,students s " +
            "where sc.coID=c.coID and sc.stuID=s.stuID " +
            "and stuClass like '%${className}%' and stuName like '%${studentName}%' and coName like '%${courseName}%'")
    IPage<StudentCourseItemVO> getPage(IPage<StudentCourseItemVO> page,@Param("className") String className,
                                       @Param("courseName") String courseName,
                                       @Param("studentName") String studentName);

    Integer countTeacherGrade(@Param("teacherId")Integer teacherId,@Param("courseName") String courseName,
                              @Param("studentName") String studentName);

    //IPage<TeacherGradeItemVO> getTeacherGradePage(IPage<TeacherGradeItemVO> page, @Param("teacherId")Integer teacherId, @Param("courseName")String courseName,@Param("studentName") String studentName);

    List<StudentCourseSelectedItemVO> listStudentCourseSelected(Integer studentId);

    List<StudentExamItemVO> listStudentExam(Integer studentId);

    Integer countStudentCourseSelectedByTimePart(@Param("studentId")Integer studentId,@Param("timePart") String timePart);

    List<TimetableItemVO> listStudentTimetable(Integer studentId);
}
